import 'package:flutter/material.dart';

class RoomListItem extends StatefulWidget {
  const RoomListItem({super.key, required this.room, required this.onPressed});
  final String room;
  final Function() onPressed;

  @override
  State<RoomListItem> createState() => _RoomListItemState();
}

class _RoomListItemState extends State<RoomListItem> {
  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      style: ElevatedButton.styleFrom(
        backgroundColor: Colors.white,
        elevation: 0,
        shadowColor: Colors.transparent,
        shape: const RoundedRectangleBorder(
          borderRadius: BorderRadius.zero,
        ),
        foregroundColor: Colors.blue,
      ),
      onPressed: widget.onPressed,
      child: Container(
        padding: const EdgeInsets.only(top: 12, bottom: 12),
        width: double.infinity,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Expanded(
                child: Text(widget.room,
                    maxLines: 2,
                    style: const TextStyle(
                        color: Colors.black87,
                        overflow: TextOverflow.ellipsis))),
            const Icon(Icons.arrow_forward_ios,
                size: 14, color: Colors.black87),
          ],
        ),
      ),
    );
  }
}
